/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package codegener.entity;

import codegener.util.StrUtils;


/**
 *
 * @author 32181
 */
public class ColumnInfo {
    
    private String tableName;
    private String name;
    private String cname;//column name
    private int orderNum;
    private String defaultValue;
    private String isNull;//是否可以为NULL,[NO|YES]
    private boolean nullAble;
    private String isPrimary;
    private boolean primary;
    private String dataType;
    private long maxLength;
    private String comments;
    private String javaType;
    private String tabcomment;

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }
    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = StrUtils.dropUnderline(name);
    }

    public int getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(int orderNum) {
        this.orderNum = orderNum;
    }

  

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public boolean isNullAble() {
        return nullAble;
    }

    public void setNullAble(boolean nullAble) {
        this.nullAble = nullAble;
    }

    public boolean isPrimary() {
        return primary;
    }

    public void setPrimary(boolean primary) {
        this.primary = primary;
    }
    
    

    public String getIsNull() {
        return isNull;
    }

    public void setIsNull(String isNull) {
        this.isNull = isNull;
    }

    public String getIsPrimary() {
        return isPrimary;
    }

    public void setIsPrimary(String isPrimary) {
        this.isPrimary = isPrimary;
    }

   

    public String getDataType() {
        return dataType;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
        if(null!=dataType&&dataType.trim().length()>0){
			if(dataType.equalsIgnoreCase("tinyint")){
				setJavaType("Integer");
			}
			if(dataType.equalsIgnoreCase("smallint")){
				setJavaType("Integer");
			}
			if(dataType.equalsIgnoreCase("int")){
				setJavaType("Integer");
			}
			if(dataType.equalsIgnoreCase("bigint")){
				setJavaType("Long");
			}
			if(dataType.equalsIgnoreCase("double")){
				setJavaType("Double");
			}
			if(dataType.equalsIgnoreCase("varchar")){
				setJavaType("String");
			}
			if(dataType.equalsIgnoreCase("longtext")){
				setJavaType("String");
			}
			if(null==this.javaType){
				setJavaType("String");
			}
		}else{
			setJavaType("String");
		}
    }

    public long getMaxLength() {
        return maxLength;
    }

    public void setMaxLength(long maxLength) {
        this.maxLength = maxLength;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }
    public String getJavaType() {
        return javaType;
    }

    public void setJavaType(String javaType) {
        this.javaType = javaType;
    }

    public String getTabcomment() {
        return tabcomment;
    }

    public void setTabcomment(String tabcomment) {
        this.tabcomment = tabcomment;
    }
    
}
